package tbdp.tool.format;

import java.util.HashMap;
import java.util.Map;

/**
 * @author xbkaishui
 * @version $Id: FormatterFactory.java, v 0.1 2017-06-24 下午2:55 xbkaishui Exp $$
 */
public class FormatterFactory {

    private static final FormatterFactory instance = new FormatterFactory();
    /**
     * format map key is format type
     */
    protected Map<String, Formatter> formatMap = new HashMap<>();

    public static FormatterFactory getInstance() {
        return instance;
    }

    public void addFormat(Formatter formatter) {
        formatMap.put(formatter.getType(), formatter);
    }

    public Formatter getFormat(String type) {
        return formatMap.get(type);
    }
}
